function Menu() {
	var menuData;

	this.openLightBoxAddGalleryItem = function(){
		(new HappyLightBox()).openContentIframe('./gallery/form_add_gallery_item.html',230,40);
	}
	
	this.openLightBoxAddGallery = function(){
		(new HappyLightBox()).openContentIframe('./gallery/form_add_gallery.html',230,40);
	}
	
	this.loadMenuData = function() {
		var xmlhttp;
		if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera,
									// Safari
			xmlhttp = new XMLHttpRequest();
		} else {// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.open("GET", "/resources/menu");
		xmlhttp.send();

		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				menuData = eval('(' + xmlhttp.responseText + ')');
				display('menu');
				$('#mega-menu').dcMegaMenu({
					rowItems : '5',
					speed : 'fast',
					effect : 'slide'
				});
			}
		}
		return menuData;
	};

	var display = function(contennerId) {

		var contenner = document.getElementById(contennerId);
		var menu = createMenu(menuData);
		menu.setAttribute('class', 'mega-menu');
		menu.setAttribute('id', 'mega-menu');
		contenner.appendChild(menu);
	};

	var createMenu = function(menuData) {
		var _ul = document.createElement('ul');
		var _li = document.createElement('li');
		var _a = document.createElement('a');
		var l = menuData.length;
		for ( var i = 0; i < l; i++) {
			var obj = menuData[i];
			_li = document.createElement('li');
			_a = document.createElement('a');

			_a.appendChild(document.createTextNode(obj.title));
			_a.setAttribute('href', obj.link);
			_li.appendChild(_a);
			if (obj.class != undefined) {
				_a.setAttribute('class', obj.class);
			}
			if (obj.child != undefined) {
				_li.appendChild(createMenu(obj.child));
			}
			_ul.appendChild(_li);
		}
		return _ul;
	};
}